﻿<!--#include file="conn.asp"-->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>批量生成HTML</title>
    <style>
        body
        {
            font-size: 9pt;
            line-height: 140%;
        }
    </style>
</head>
<body>
    <%
set rs=server.createobject("adodb.recordset")
set rsm=server.createobject("adodb.recordset")
id=request("id")
rs.open "select * from zj where id="&request("id"),conn,1,1
     if not rs.eof then
	 id=rs("id")
	 cid=rs("cid")
       comic_name=""
       zjid=rs("id")
	   zjmc=rs("zjmc")
	   tpadd=rs("tpadd")
	   tpurl=rs("tpurl")
	   tpf=rs("tpf")
	   tps=rs("tps")
	   add_date=rs("adddate")
	    hits=rs("hits")
	   datetime=year(rs("adddate"))&"-"&month(rs("adddate"))&"-"&day(rs("adddate"))
	 end if
   rs.close    
rs.open "select * from comics where id="&cid,conn,1,1
if not rs.eof then
comic_name=rs("mhmc")
comic_zm=rs("zm")
comic_mhfm=rs("mhfm")
zzid=rs("zzid")
 end if
   rs.close  

   rs.open "select * from zz where id="&zzid,conn,1,1
if not rs.eof then
zz_name=rs("zzmc")
 end if
   rs.close  

   next_zjcount = 0
   rs.open "select top(1) * from zj where id>"&id&" and cid="&cid&" order by id",conn,1,1
if not rs.eof then
next_zjcount=next_zjcount+1
next_zjid=rs("id")
else
next_zjid=id
 end if
   rs.close  

      rs.open "select top(1) * from zj where id<"&id&" and cid="&cid&" order by id desc",conn,1,1
if not rs.eof then
prev_zjid=rs("id")
else
prev_zjid=id
 end if
   rs.close  

Set fso = Server.CreateObject("Scripting.FileSystemObject")
pencat=ReadFromTextFile("TEMP/show.htm","utf-8")
pencat=commonreplace(pencat)

imgurl=Split(tpurl,"|")
for i=0 to  ubound(imgurl)
tpArr=Split(imgurl(i),"/")
imgurl(i)=tpArr(ubound(tpArr))
next

zjjs=zjjs&"var total="&tps&";var volpic='"&tpadd&"';var tpf = "&tpf&";"

pencat=replace(pencat,"[TITLE]",comic_name)
pencat=replace(pencat,"[ZJNAME]",zjmc)
pencat=replace(pencat,"[XZ]",xzj)
pencat=replace(pencat,"[ID]",id)
pencat=replace(pencat,"[WEB_NAME]",web_name)
pencat=replace(pencat,"[WEB_URL]",web_url)
pencat=replace(pencat,"[WEB_BA]",miibeian)
pencat=replace(pencat,"[IMGURL]",Join(imgurl,"|"))

pencat=replace(pencat,"[CID]",cid)
pencat=replace(pencat,"[ZJID]",id)
pencat=replace(pencat,"[NEXT_ZJCOUNT]",next_zjcount)
pencat=replace(pencat,"[NEXT_ZJID]",next_zjid)
pencat=replace(pencat,"[PREV_ZJID]",prev_zjid)
pencat=replace(pencat,"[ZM]",comic_zm)
pencat=replace(pencat,"[MHFM]",comic_mhfm)
pencat=replace(pencat,"[ZZ_NAME]",zz_name)

'if fso.folderexists(server.mappath("../comicdata/"&tpadd))=true then
'pencat=replace(pencat,"[IMGADDRESS]","/comicdata/"&tpadd)
if fso.folderexists("E:/comicdata/"&tpadd)=true then
pencat=replace(pencat,"[IMGADDRESS]","/comicdata1/"&tpadd)
else
pencat=replace(pencat,"[IMGADDRESS]","/comicdata/"&tpadd)
end if

pencat=adreplace(pencat)

if fso.folderexists(server.mappath("../comic/"&cid&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comic/"&cid&"\"&foldername))
end if
if fso.folderexists(server.mappath("../comic/"&cid&"/"&zjid&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comic/"&cid&"/"&zjid&"\"&foldername))
end if
WriteToTextFile "../comic/"&cid&"/"&zjid&"/index.htm",pencat,"utf-8"

if request("type")="page" then%><font color="#FF0000">生成漫画页面完成</font><script language="JavaScript">
<!--
                                                                         setTimeout('window.close();', 500);
// -->
</script>
    <%end if%>
</body>
</html>
